/*
 react、react-router示例
 */
import React from 'react'
import ReactDOM from "react-dom"
import {
    BrowserRouter as Router,
    Route,
    Link
} from 'react-router-dom'


const About = ()=>(
    <div><h2>About</h2></div>
)
const Home = ()=>(
    <div><h2>Home</h2></div>
)

const App = ()=>(
    <Router>
        <div>
            <div>welcome !</div>
            <ul>
                <li><Link to='/home'>home</Link></li>
                <li><Link to='/about'>about</Link></li>
            </ul>
            <Route exact path='/' component={Home}></Route>
            <Route path='/home' component={Home}></Route>
            <Route path='/about' component={About}></Route>
        </div>
    </Router>
)


ReactDOM.render(
    <App/>,
    document.getElementById('root')
);